/**
 * 国际化相关demo
 */
import 'package:flutter_benchu/utils/commonPkg.dart';

class LanguageDemoPage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() => _LanguageDemoPageState();
}

class _LanguageDemoPageState extends State<LanguageDemoPage> {
  @override
  Widget build(BuildContext context) {
    AppNotifier appNotifier = Provider.of<AppNotifier>(context);
    return Scaffold(
      appBar: AppBar(title: Text('切换语言')),
      body: Column(
        children: [
          InkWell(
            onTap: () {
              //切换语言
              var location = cacheModel.language == 'zh_CN' ? 'en_US' : 'zh_CN';
              appNotifier.setLocale(location);
            },
            child: Text(text(context, Ids.homeSwitchlanguage)), //切换语言
          ),
        ],
      ),
    );
  }
}
